
cc.Class({
    extends: cc.Component,

    properties: {
       
    },

    onLoad () {

    },

    init_1:function(pos){
        this.node.stopAllActions()
        var i_num_1 = Math.floor(Math.random() * 256)
        var i_num_2 = Math.floor(Math.random() * 256)
        var i_num_3 = Math.floor(Math.random() * 256)
        if(Math.random() < 0.6){
            i_num_1 = 255
            i_num_2 = 255
            i_num_3 = 255
        }
        this.node.color = new cc.Color(i_num_1, i_num_2, i_num_3);
        var x_min = pos.x - 150
        var y_min = pos.y - 50
        var pos_begin = cc.v2(x_min+Math.random()*300,y_min+Math.random()*250)
        this.node.setPosition(pos_begin)
        this.node.scale = 0.5 + Math.random() * 0.5

        var act_1 = cc.moveTo(0.3+Math.random() *100 * 0.005,pos)
        var act_2 = cc.callFunc(function(){
            game.onDianKilled(this.node)
        }.bind(this))
        var end = cc.sequence(act_1,act_2)
        this.node.runAction(end)
    },

    init_2:function(pos){
        this.node.stopAllActions()
        var i_num_1 = Math.floor(Math.random() * 256)
        var i_num_2 = Math.floor(Math.random() * 256)
        var i_num_3 = Math.floor(Math.random() * 256)
        if(Math.random() < 0.6){
            i_num_1 = 255
            i_num_2 = 255
            i_num_3 = 255
        }
        this.node.color = new cc.Color(i_num_1, i_num_2, i_num_3);
        var x_min = pos.x - 120
        var pos_end = cc.v2(x_min+Math.random()*240,pos.y+Math.random()*150)
        this.node.setPosition(pos)
        this.node.scale = 0.3 + Math.random() * 0.3

        var act_1 = cc.moveTo(0.3+Math.random() *100 * 0.002,pos_end)
        var act_2 = cc.callFunc(function(){
            game.onDianKilled(this.node)
        }.bind(this))
        var end = cc.sequence(act_1,act_2)
        this.node.runAction(end)
    },

    update (dt) {

    },
});
